<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <SCript>
        //输出数组的最大值和最小值
        var arr = [1, 2, 3, 4, 5];
        var max = arr[0];
        var min = arr[0];
        for (var i = 1; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
            if (arr[i] < min) {
                min = arr[i];
            }

        }
        console.log("最大值：" + max);
        console.log("最小值：" + min);
        
    </SCript>
</body>

</html>